<?php
//echo Yii::app()->shoppingCart->getCost();
if (isset(Yii::app()->user->id)) {
    $item = Yii::app()->shoppingCart->getItemsCount();
    $total = Yii::app()->shoppingCart->getCost();
    $curr = Yii::app()->user->getState('currency');
    //echo 'vinh show: '.$item.'-'.$total.'-'.$curr;
    ?>
    <div class="signin-form">
        <p class="signin-form-user">
            <span>Welcome: </span>
            <span style="color:red;"><?php echo CHtml::link(user()->getModel('display_name'), array('user/index')); ?></span> <?php echo CHtml::link('Logout', array('site/logout'), array('class' => 'buttonsubmit')); ?>
        </p>  
        <p>Cart: <span id="item_gio_hang" class="row_card_title"><?= $item ?> item(s)</span></p>
        <p>Total: <span id="total_price_gio_hang" class="row_card_title"><?= $total ?> <?= $curr ?></span></p>
        <?php
        if ($item > 0) {
            ?>
            <div>
                <?php //echo CHtml::link('View Cart',array('checkout/viewcart'),array('class'=>'buttonsubmit'));?> <?php echo CHtml::link('Checkout', array('checkout/index'), array('class' => 'buttonsubmit')); ?>
            </div>
        <?php } ?>
    </div>
    <?php
} else {
    ?>
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'login-form',
        'enableClientValidation' => true,
        'clientOptions' => array(
            'validateOnSubmit' => true,
        ),
    ));
    //echo $form->errorSummary($model);
    ?>
    <div class="signin-form">
        <p class="signin-form-user">
            <?php echo $form->textField($model, 'username', array('placeholder' => 'Username ...')); ?>
        </p>
        <?php echo $form->error($model, 'username'); ?>
        <p class="signin-form-pass">
            <?php echo $form->passwordField($model, 'password', array('placeholder' => 'Password ...')); ?>
        </p>
        <?php echo $form->error($model, 'password'); ?>
        <p class="signin-form-forregister">
            <?php echo CHtml::link('&#272;&#259;ng K&yacute;', array("user/register"), array('class' => 'colorlink')); ?>
            <span class="colorspan"> | </span>
            <?php echo CHtml::link('Qu&ecirc;n M&#7853;t Kh&#7849;u', array("user/forgetPass"), array('class' => 'colorlink')); ?>
        </p>
        <p class="signin-form-submit">
            <?php echo CHtml::submitButton(t('cms', 'Login'), array('class' => 'buttonsubmit')); ?>
        </p>
    </div>
    <?php $this->endWidget(); ?>
    <div class="clear"></div>

    <?php
}
?>